
{notpresent name="pn" }
    {assign name="pn" value="1"}
{/notpresent}
<?php $user=loginUser(); ?>
<div class="notice-bar">
    <div class="container" style="text-align: left;padding: 5px 0;">
    {if $user !=null }
        <a href="/user/home">邀请新用户</a>
        {if $user.email_ack==0 }
        <a href="/user/home">绑定邮箱（硬币+10）</a>
        {/if}
    {/if}
        <!--<span style="color: #5f5f5f;color:#ea4141;">2022内测福利，永久会员仅需199元，全站所有课程及以后更新课程免费学，为知识助力。</span>-->
        <span style="color: #5f5f5f;color:#ea4141;">
        <?php echo dict('公告','顶部公告'); ?>
        </span>
    </div>
</div>
<nav class="navbar navbar-main navbar-inverse">
    <div class="-container">
        <!-- Brand and toggle get grouped for better mobile display -->
        <div class="navbar-header">
            <button type="button" class="navbar-toggle collapsed" data-toggle="collapse" data-target="#bs-example-navbar-collapse-1" aria-expanded="false">
                <span class="sr-only">Toggle navigation</span>
                <span class="icon-bar"></span>
                <span class="icon-bar"></span>
                <span class="icon-bar"></span>
            </button>
            <a class="navbar-brand" href="/">{$sitename}</a>
        </div>

        <!-- Collect the nav links, forms, and other content for toggling -->
        <div class="collapse navbar-collapse" id="bs-example-navbar-collapse-1">
            <ul class="nav navbar-nav">

                {volist name='topMenuList' id='mo'}
                {if $mo.is_parent eq 0 }
                    <li><a href="{$mo.link}">{$mo.name}</a></li>
                {else}
                <li class="dropdown">
                    <a href="{$mo.link}" class="dropdown-toggle" data-toggle="dropdown" role="button" aria-haspopup="true" aria-expanded="false">{$mo.name} <span class="caret"></span></a>
                    <ul class="dropdown-menu">
                        {volist name='$mo.children' id='mo2'}
                        <li><a href="{$mo2.link}">{$mo2.name}</a></li>
                        {/volist}
                    </ul>
                </li>
                {/if}
                {/volist}

            </ul>
            <!--<form class="navbar-form navbar-left">
                <div class="form-group">
                    <input type="text" class="form-control" placeholder="Search">
                </div>
                <button type="submit" class="btn btn-default">Submit</button>
            </form>-->
            <ul class="nav navbar-nav navbar-right">
                <li>
                    <form id="fsearch827" action="/search" class="form-inline">
                        <div style="position: relative;top: 4px;">
                            <input type="text" class="form-control" name="key" placeholder="搜索">
                            <div class="search-btn" onclick="$('#fsearch827').submit();">
                                <span class="glyphicon glyphicon-search" aria-hidden="true"></span>
                            </div>
                        </div>

                        <!--<div class="form-group" style="position: relative;top: 5px;">
                            <div class="input-group">
                                <input type="text" class="form-control" name="key" placeholder="请输入想搜的内容">
                                <div class="input-group-addon" style="cursor: pointer" onclick="$('#fsearch827').submit();">
                                    <span class="glyphicon glyphicon-search" aria-hidden="true"></span>
                                </div>
                            </div>
                        </div>-->
                    </form>
                </li>
                {if session('login_user')!=null }
                <li><a href="/share/create.html">发表</a></li>

                <li class="dropdown">
                    <a href="#" class="dropdown-toggle" data-toggle="dropdown" role="button" aria-haspopup="true" aria-expanded="false">
                        <?php echo session('login_user')->nickname;?>
                        <span class="caret"></span>
                    </a>
                    <ul class="dropdown-menu">
                        <li><a href="/user/home.html"><span class="glyphicon glyphicon-home"></span> 个人主页</a></li>
                        <!--<li><a href="#"><span class="glyphicon glyphicon-leaf"></span> 我的后台</a></li>
                        <li><a href="#"><span class="glyphicon glyphicon-cog"></span> 设置资料</a></li>-->
                        <li role="separator" class="divider"></li>
                        <li><a href="/logout"><span class="glyphicon glyphicon-off"></span> 退出系统</a></li>
                    </ul>
                </li>
                {else}
                <!--<li><a href="http://auth.itsub.cn/qq/authorize?redirect_uri={:BASE_URL}/connect">QQ登录(免注册)</a></li>-->
                <!--<li><a href="http://auth.itsub.cn/qq/authorize?redirect_uri=http://ke.itsub.cn/connect">登录</a></li>-->
                <li><a href="/qq/login">QQ登录</a></li>

                {/if}
            </ul>
        </div><!-- /.navbar-collapse -->
    </div><!-- /.container-fluid -->
</nav>

<script>
    $(document).ready(function(){
        $(document).off('click.bs.dropdown.data-api');
    });



    $(document).ready(function(){
        dropdownOpen();//调用
    });
    /**
     * 鼠标划过就展开子菜单，免得需要点击才能展开
     */
    function dropdownOpen() {

        var $dropdownLi = $('li.dropdown');

        $dropdownLi.mouseover(function() {
            $(this).addClass('open');
        }).mouseout(function() {
            $(this).removeClass('open');
        });
    }
</script>